import textwrap
# 定义用户类User
# 包含私有属性id,sid,name,qq,autocard,sendEmail
# 包含函数toString(),可以直接使用名称对相应私有属性进行操作
class User:
    # 构造函数
    def __init__(self,
    id,
    sid,
    name,
    qq,
    autocard,
    sendEmail
    ) -> None:
        self.__id = id
        self.__sid = sid
        self.__name = name
        self.__qq = qq
        self.__autocard = 1 if autocard else 0
        self.__sendEmail = 1 if sendEmail else 0

    @property
    def id(self):
        return self.__id
    @id.setter
    def id(self,value):
        self.__id = value

    @property
    def sid(self):
        return self.__sid
    @sid.setter
    def sid(self,value):
        self.__sid = value

    @property
    def name(self):
        return self.__name
    @name.setter
    def name(self,value):
        self.__name = value

    @property
    def qq(self):
        return self.__qq
    @qq.setter
    def qq(self,value):
        self.__qq = value

    @property
    def autocard(self):
        return self.__autocard
    @autocard.setter
    def autocard(self,value):
        self.__autocard = value

    @property
    def sendEmail(self):
        return self.__sendEmail
    @sendEmail.setter
    def sendEmail(self,value):
        self.__sendEmail = value

    def toString(self):
        return textwrap.dedent(f"""
        id={self.__id},
        sid={self.__sid},
        name={self.__name},
        qq={self.__qq},
        autocard={self.__autocard},
        sendEmail={self.__sendEmail}.
        """)

    def toDic(self):
        return {
            'id': self.__id,
            'sid': self.__sid,
            'name': self.__name,
            'qq': self.__qq,
            'autocard': True if self.__autocard else False,
            'sendEmail': True if self.__sendEmail else False
        }

    def toCell(self):
        return (
            self.__id,
            self.__sid,
            self.__name,
            self.__qq,
            self.__autocard,
            self.__sendEmail
        )
